
#include "VertexPosition2ColorTexture.h"
#include "VertexDeclaration.h"

using namespace Riccsson::Xna::Framework::Graphics;

GC_PTR<VertexDeclaration> VertexPosition2ColorTexture::vertexDeclaration;

VertexPosition2ColorTexture::VertexPosition2ColorTexture( Riccsson::Xna::Framework::Vector2 position, Riccsson::Xna::Framework::Color color_, Riccsson::Xna::Framework::Vector2 texCoord )
{
	Position = position;
	color = color_;
	TextureCoordinate = texCoord;
}
		
int VertexPosition2ColorTexture::GetSize()
{
	return sizeof(float)*4+sizeof(uint);
}

// TODO: ???
//VertexDeclaration IVertexType.VertexDeclaration
//{
//	get
//	{
//		return VertexDeclaration;
//	}
//}

int VertexPosition2ColorTexture::GetHashCode()
{
	// TODO: FIc gethashcode
	return 0;
}

GC_PTR<Riccsson::System::string> VertexPosition2ColorTexture::ToString()
{
	//return string.Format("{{Position:{0} Color:{1} TextureCoordinate:{2}}}", new object[] { this.Position, this.Color, this.TextureCoordinate });
	throw;
}

					
bool VertexPosition2ColorTexture::Equals(const Riccsson::System::object* obj)
{
	if (obj == null)
		return false;

	if (obj->GetType() != Riccsson::System::object::GetType())
		return false;

	return (this == ((VertexPosition2ColorTexture*)obj));
}

REGISTER_CLASS_CPP(VertexPosition2ColorTexture)
{
	var elements = Riccsson::System::Array<VertexElement>(3);
	elements.Insert( 0, VertexElement(0, VertexElementFormat::Vector2, VertexElementUsage::Position, 0));
	elements.Insert( 1, VertexElement(8, VertexElementFormat::Color, VertexElementUsage::Color, 0));
	elements.Insert( 2, VertexElement(12, VertexElementFormat::Vector2, VertexElementUsage::TextureCoordinate, 0));
	VertexPosition2ColorTexture::vertexDeclaration = new VertexDeclaration(&elements);
}

bool operator ==(const VertexPosition2ColorTexture& left, const VertexPosition2ColorTexture& right)
{
	return (((left.Position == right.Position) && (left.color == right.color)) && (left.TextureCoordinate == right.TextureCoordinate));
}

bool operator !=(const VertexPosition2ColorTexture& left, const VertexPosition2ColorTexture& right)
{
	return !((((left.Position == right.Position) && (left.color == right.color)) && (left.TextureCoordinate == right.TextureCoordinate)));
}

//RUN_STATIC(VertexPosition2ColorTexture)